<%-- 
    Document   : modify
    Created on : Mar 17, 2012, 12:37:26 PM
    Author     : admin
--%>

<%-- Header Area --%>
<%@ include file="/template/header.jsp" %> 
<%-- End of Header Area --%>


<%-- Content Area --%>

<h2>${title}</h2>
<div class="submenu">
    <ul>
        <li><a href="/manage/product">Go back</a></li>
    </ul>
    <div class="clear"></div>
</div>
<form  method="POST" action="/manage/product/modify?id=<%= product.getId() %>&true" enctype="multipart/form-data">
    
    <table class="generic-form-table" cellspacing="0">
        <tr>
            <td>
                <fieldset>
                    <legend>Product Information</legend>
                    <table>
                        <tr>
                            <th><label>Product Name</label></th>
                            <td><input type="text" name="name" validate="form" require="<b>Required Field Missing</b><br/>Please enter the product's name." value="<%= product.getName() %>" /></td>
                        </tr>
                        <tr>
                            <th><label>Category</label></th>
                            <td>
                                <select name="category" class="product_category">
                                    <% if (categories != null) {%>

                                        <% for (Category c : categories) {%>
                                        <option value="<%= c.getId()%>" <%= c.getId() == product.getCategory_id() ? "selected='selected'" : "" %>><%= c.getName()%></option>
                                        <% }%>
                                        
                                    <% } %>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th><label>Description</label></th>
                            <td>
                                <textarea name="description" validate="form" require="<b>Required Field Missing</b><br/>Please enter a product description."><%= product.getDescription() %></textarea>
                            </td>
                        </tr>
                        <tr>
                            <th><label>Image</label></th>
                            <td><input type="file" name="image" /></td>
                        </tr>
                    </table>
                </fieldset>
            </td>
        </tr>

        <tr>
            <td colspan="2" align="right">
                <input type="submit" value="Submit" name="modify" onClick="return validate('form')" />
                <input type="button" value="Reset" onClick="reload()" />
            </td>
        </tr>

    </table>
</form>


<%-- Footer Area --%>
<%@ include file="/template/footer.jsp" %>
<%-- End of Footer Area --%>